package com.guoranhao.business.model;

import com.guoranhao.tool.model.BaseModel;
import com.guoranhao.tool.model.CommonConstants;
import com.guoranhao.tool.model.FieldComment;
import lombok.Data;
import lombok.experimental.Accessors;

import javax.validation.constraints.NotNull;
import java.math.BigDecimal;
import java.util.Date;

@Data
@Accessors(chain = true)
public class EsSpu extends BaseModel {
    /**
     * 商品ID
     */
    @FieldComment(value="商品ID")
    @NotNull(message="商品ID")
    private Long spuId;

    /**
     * 商品名称
     */
    @FieldComment(value="商品名称")
    @NotNull(message="商品名称")
    private String name;

    /**
     * 税号编码
     */
    @FieldComment(value="税号编码")
    private String taxCode;

    /**
     * 商品副标题
     */
    @FieldComment(value="商品副标题")
    private String secondaryName;

    /**
     * 商品分类
     */
    @FieldComment(value="商品分类")
    @NotNull(message="商品分类")
    private Long categoryId;

    /**
     * 商场参考价
     */
    @FieldComment(value="商场参考价")
    private BigDecimal marketPrice;

    /**
     * 最低售价
     */
    @FieldComment(value="最低售价")
    private BigDecimal lowerPrice;

    /**
     * 1:有效 0：无效
     */
    @FieldComment(value="1")
    @NotNull(message="1")
    private Integer spuStatus;

    /**
     * 是否发布 0:未发布 1:已发布
     */
    @FieldComment(value="是否发布")
    @NotNull(message="是否发布")
    private Integer publishStatus;

    /**
     * 商品发布时间
     */
    @FieldComment(value="商品发布时间")
    private Date publishDate;

    /**
     * 主图
     */
    @FieldComment(value="主图")
    private String mainImage;

    /**
     * 商品详情图
     */
    @FieldComment(value="商品详情图")
    private String detailImages;

    /**
     * 详情内容
     */
    @FieldComment(value="详情内容")
    private String detailContent;

    /**
     * 虚拟月销量
     */
    @FieldComment(value="虚拟月销量")
    private Integer virtualMonthlySales;

    /**
     * 商品支付超时时间 默认24小时
     */
    @FieldComment(value="商品支付超时时间")
    private Integer payOvertime;

    private Long createUserId;

    private Date createTime;

    private Long lastModifyUserId;

    private Date updateTime;

    public void initWithDefaultValue() {
        this.name = "";
        this.taxCode = "";
        this.secondaryName = "";
        this.categoryId = 0L;
        this.marketPrice = BigDecimal.valueOf(0);
        this.lowerPrice = BigDecimal.valueOf(0);
        this.spuStatus = 0;
        this.publishStatus = 0;
        this.publishDate = CommonConstants.NULL_DATE;
        this.mainImage = "";
        this.detailImages = "";
        this.detailContent = "";
        this.virtualMonthlySales = 0;
        this.payOvertime = 0;
        this.createUserId = 0L;
        this.createTime = new Date();
        this.lastModifyUserId = 0L;
        this.updateTime = new Date();
    }
}